TYPE _key;
	int  keyCode;
	int  keyPressed;
	int  keyDown;
	int  keyUp;
END

GLOBAL
	//los keys disponibles
	_key availableKeys[] =   _down, 0, 0, 0,
										_up, 0, 0, 0,
										_left, 0, 0, 0,
										_right, 0, 0, 0	,
										_space, 0, 0, 0,
										_control, 0, 0, 0	;
END
CONST

	//posicion en el array de keys
	DOWNk = 0;
	UPk = 1;
	LEFTk = 2;
	RIGHTk = 3;
	JUMPk = 4;
	CROUCHk = 5;
	keysLenght = 6; // cantidad de keys
END





PROCESS inputmanager()
PRIVATE
	i = 0;
END
BEGIN
	LOOP
	FOR(i = 0; i< keysLenght; i++)
		IF ( key(availableKeys[i].keyCode) )
			IF ( NOT availableKeys[i].keyPressed )
				availableKeys[i].keyDown		= 1;
				//print("keyDown  " + availableKeys[i].keyCode);
				availableKeys[i].keyPressed 	= 1;
			ELSE
				availableKeys[i].keyDown 		= 0;
			END
		ELSE	
			IF (  availableKeys[i].keyPressed)
				 availableKeys[i].keyUp 			= 1;
				//print("keyUp  " + availableKeys[i].keyCode);
				 availableKeys[i].keyPressed 	= 0;
			ELSE
				availableKeys[i].keyUp			= 0;
			END
		END
	END
	frame;
	END
END
